﻿using Day27Auth.Controllers;
using Day27Auth.Framework;
using System.Web;
using System.Web.Optimization;

namespace Day27Auth
{
    public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));

            bundles.Add(new ScriptBundle("~/bundles/angular").Include(
                "~/Scripts/angular.js",
                "~/Scripts/angular-route.js"
            ));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));

            //bundles.Add(new ScriptBundle("~/bundles/todo").Include(
            //    "~/app/app.js",
            //    "~/app/routes.js",
            //    "~/app/services/AuthFactory.js",
            //    "~/app/controllers/HomeController.js",
            //    "~/app/controllers/LogoutController.js",
            //    "~/app/controllers/TodoController.js",
            //    "~/AngularJS/Routes"
            //));

            var vBundle = new VirtualMethodBundle("~/bundles/todo");
            vBundle.Include(
                 "~/app/app.js",
                "~/app/routes.js",
                "~/app/services/AuthFactory.js",
                "~/app/controllers/HomeController.js",
                "~/app/controllers/LogoutController.js",
                "~/app/controllers/TodoController.js"
                //"~/Views/AngularJS/_Routes.cshtml"
            );

            vBundle.Include<AngularJSController>(c => c.Routes);

            bundles.Add(vBundle);

            // Set EnableOptimizations to false for debugging. For more information,
            // visit http://go.microsoft.com/fwlink/?LinkId=301862
            BundleTable.EnableOptimizations = true;
        }
    }
}
